<div class="view-body">
    <div class="view-inner">
        <div class="view-cont system-admin-cont system-auth-create">
            <header class="view-cont-hd clearfix">
                <!--页面标题-->
                <a ui-sref="corp/detail(vm.stateParam)" class="btn btn-default btn-xs btn-back"><i class="fa fa-reply"></i>返回上一级</a>
                <!--面包屑-->
                <ol class="breadcrumb">
                    <li>
                        <a ui-sref="corp">组织管理</a>
                    </li>
                    <li>
                        <a ui-sref="corp/detail(vm.stateParam)">{{vm.current.page}}</a>
                    </li>
                    <li class="active">
                        <strong>指定权限</strong>
                    </li>
                </ol>
            </header>
            <section class="view-cont-bd">
                <div class="row row-pane">
                    <div class="col-sm-8">
                        <div class="panel panel-default">
                            <div class="panel-heading">
                                <h3 class="panel-title">权限列表</h3>
                            </div>
                            <div class="panel-body">
                                <div class="alert alert-info">
                                    当前{{vm.current.type}} &gt;&gt; <strong>{{vm.current.typeName}}</strong>
                                </div>
                                <div ui-tree data-drag-enabled="false" >
                                    <table class="table-tree" ui-tree-nodes ng-model="vm.treeNode">
                                        <thead>
                                        <tr>
                                            <th style="width: 50%">权限</th>
                                            <th>描述</th>
                                        </tr>
                                        </thead>
                                        <tbody>
                                        <tr ng-show="!vm.isLoad">
                                            <td colspan="2"><i class="fa fa-spin fa-spinner"></i>数据加载中...</td>
                                        </tr>
                                        <tr ng-show="vm.isLoad" ui-include-replace data-collapsed="true" ng-repeat="node in ::vm.treeNode" ui-tree-node ng-include="'nodes_table_renderer.html'"></tr>
                                        </tbody>
                                    </table>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="col-sm-4">
                        <div class="panel panel-default">
                            <div class="panel-heading">
                                <h3 class="panel-title">操作记录</h3>
                            </div>
                            <div class="panel-body">
                                <ul class="list-log" ng-show="vm.addMenuList.length == 0 && vm.delMenuList.length == 0 && vm.addCompList.length == 0 && vm.delCompList.length == 0">
                                    <li class="list-log-item text-center"><i class="fa fa-exclamation-circle"></i>暂无操作记录</li>
                                </ul>
                                <div class="log-list" ng-if="vm.addMenuList.length || vm.delMenuList.length">
                                    <ul class="list-group" ng-if="vm.addMenuList.length">
                                        <li class="list-item-lead list-group-item-success"><i class="fa fa-plus"></i>新增菜单权限：</li>
                                        <li class="list-group-item list-group-item-info" ng-repeat="item in vm.addMenuList track by $index">{{item.menuName}}</li>
                                    </ul>
                                    <ul class="list-group" ng-show="vm.delMenuList.length">
                                        <li class="list-item-lead list-group-item-danger"><i class="fa fa-times"></i>排除菜单权限：</li>
                                        <li class="list-group-item list-group-item-info" ng-repeat="item in vm.delMenuList track by $index">{{item.menuName}}</li>
                                    </ul>
                                    <button class="btn btn-primary btn-xs" type="button" ng-click="vm.save('menu')"><i class="fa fa-check"></i>确定</button>
                                </div>
                                <div class="log-list" ng-if="vm.addCompList.length || vm.delCompList.length">
                                    <ul class="list-group" ng-if="vm.addCompList.length">
                                        <li class="list-item-lead list-group-item-success"><i class="fa fa-plus"></i>新增控件权限：</li>
                                        <li class="list-group-item list-group-item-info" ng-repeat="item in vm.addCompList track by $index">{{item.compName}}</li>
                                    </ul>
                                    <ul class="list-group" ng-if="vm.delCompList.length">
                                        <li class="list-item-lead list-group-item-danger"><i class="fa fa-times"></i>排除控件权限：</li>
                                        <li class="list-group-item list-group-item-info" ng-repeat="item in vm.delCompList track by $index">{{item.compName}}</li>
                                    </ul>
                                    <button class="btn btn-primary btn-xs" type="button" ng-click="vm.save('com')"><i class="fa" ng-class="{'fa-check': vm.isLoad, 'fa-spin fa-spinner': !vm.isLoad}"></i>确定</button>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </section>
        </div>
    </div>
</div>
<script type="text/ng-template" id="nodes_table_renderer.html">
    <tr>
        <td width="50%">
            <div ui-tree-handle class="tree-node tree-node-content">
                <input type="checkbox" class="node-checkbox" ng-checked="node.hadPriv" ng-click="vm.toggleCheck('menu',node)" />
                <a data-nodrag class="tree-node-handle" href="#" ng-click="vm.toggleNode(this, node, $event)">
                    <span class="fa" ng-class="{'fa-folder': collapsed, 'fa-folder-open': !collapsed, 'fa-file': !node.hasChildren}"></span>
                    <span class="tree-node-name" ng-class="{on: this.current}">{{node.menuName}}</span>
                </a>
                <span ng-show="node.loading"><i class="fa fa-spin fa-spinner"></i></span>
            </div>
        </td>
        <td>{{node.menuDesc}}</td>
    </tr>
    <tr class="tree-tr" ui-tree-nodes ng-model="node.nodes" ng-class="{hidden: collapsed}">
        <td colspan="2">
            <table>
                <tr ui-include-replace collapsed="true" ng-repeat="node in node.nodes" ui-tree-node ng-include="'nodes_table_renderer.html'">
                </tr>
            </table>
        </td>
    </tr>
    <tr class="tree-tr" ng-model="node.compNodes" ng-class="{hidden: collapsed}">
        <td colspan="2">
            <table>
                <tr data-collapsed="true" ng-repeat="node in node.compNodes" ui-tree-node>
                    <td style="width: 50%">
                        <div ui-tree-handle class="tree-node tree-node-content">
                            <input type="checkbox" class="node-checkbox" ng-checked="node.hadPriv" ng-click="vm.toggleCheck('com',node)" />
                            <a data-nodrag class="tree-node-handle">
                                <span class="fa fa-cube"></span>
                                <span class="tree-node-name" ng-class="{on: this.current}">{{node.compName}}</span>
                            </a>
                            <span ng-show="node.loading"><i class="fa fa-spin fa-spinner"></i></span>
                        </div>
                    </td>
                    <td>
                        {{node.privGrantId}}
                    </td>
                </tr>
            </table>
        </td>
    </tr>
</script>
